package com.atguigu.dwm.ds.mapper;

import com.atguigu.dwm.ds.bean.TDsTaskDefinition;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhangchen
 * @since 2024-07-08
 */
@Mapper
@DS("ds")
public interface TDsTaskDefinitionMapper extends BaseMapper<TDsTaskDefinition> {

    @Select("     select td.name, td.task_params    from t_ds_task_instance   tii\n" +
            "     join t_ds_task_definition td on tii.task_code = td.code\n" +
            "     where tii.id in (\n" +
            "      select max(id) from t_ds_task_instance  ti where ti.state=7  and ti.name in ( ${inSql})" +
            "          group by ti.name " +
            "     ) " )
    List<TDsTaskDefinition> getTaskDefinitionList(@Param("inSql") String inSql);
}
